<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    /*var obj={name:"damu"}
    console.log(obj.name)

    var obj2 = {
        get name(){
            console.log("obj2.name GET");
            return "我的冬雨"
        },
        set name(val){
            console.log("obj2.name SET",val);
        }
    }
    obj2.name = "周冬雨"
    console.log(obj2.name);*/


    var obj3 = {};
    Object.defineProperty(obj3,"name",{
        get(){
            console.log("obj3.name GET");
            return "我的冬雨"
        },
        set(val){
            console.log("obj3.name SET",val);
        }
    })
    obj3.name = "周冬雨"
    console.log(obj3.name);
</script>
</html>